import httpx
from anyio import run
from my_webdav.resource_model.drive_115.data_operate import OperateLayer, CacheLayer, ClientFor115
from my_webdav.config import app_setting


client_param = {
    "proxies": app_setting.PROXY_ADDR,
    "verify": app_setting.VERIFY_CA
}


async def main():
    root_id = app_setting.PAN_115_ROOT_CID
    cookie = app_setting.PAN_115_COOKIE
    async with httpx.AsyncClient(**client_param) as a_client:
        with httpx.Client(**client_param) as s_client:
            client_115 = ClientFor115(root_id, cookie, a_client, s_client)
            user_key = await client_115.get_upload_info()
            res = await client_115.get_token_url()
            token_url = res.token_url
            res = await client_115.get_upload_token(token_url)
            return res


rr = run(main)
